package mapControl;


import net.datastructures.NodePositionList;
import net.datastructures.Position;
import net.datastructures.PositionList;
import powerUp.PowerUp;
import wallFactory.builders.WallBox;
import elementos.Bomba;
import elementos.Elemento;
import elementos.Player;
import enemies.Enemy;

public class Celda {

	public WallBox getDesWallBox() {
		return desWallBox;
	}

	public void setDesWallBox(WallBox desWallBox) {
		this.desWallBox = desWallBox;
	}

	public Elemento getNonDesWallBox() {
		return nonDesWallBox;
	}

	public void setNonDesWallBox(WallBox nonDesWallBox) {
		this.nonDesWallBox = nonDesWallBox;
	}

	protected WallBox desWallBox;
	protected WallBox nonDesWallBox;
	protected Player player;
	protected PositionList<Enemy> enemies;
	protected PowerUp powerUp;
	protected Bomba bomba;
	private int row;
	private int col;
	private String name;

	public Celda(int row, int col) {
		super();
		this.row = row;
		this.col = col;
		name = "[" + row + "," + col + "]";
		enemies = new NodePositionList<Enemy>();

	}
	
	public int getRow() {
		return row;
	}
	public int getCol() {
		return col;
	}
	

	public String getName() {
		return name;
	}

	public Player getPlayer() {
		return player;
	}

	public void setPlayer(Player player) {
		this.player = player;

	}

	public PositionList<Enemy> getEnemies() {
		return enemies;
	}


	public Position<Enemy> addEnemy(Enemy e) {
		enemies.addLast(e);
		return enemies.last();
	}

	public PowerUp getPowerUp() {
		return powerUp;
	}

	public void setPowerUp(PowerUp powerUp) {
		this.powerUp = powerUp;
	}

	public Bomba getBomba() {
		return bomba;
	}

	public void setBomba(Bomba bomba) {
		this.bomba = bomba;
	}

	public boolean isEmpty() {

		return (desWallBox == null && nonDesWallBox == null);
		
	}

	public boolean isEmpty4g() {

		//	return (desWallBox == null && nonDesWallBox == null);
			return (nonDesWallBox == null);
		}

	
	
	@Override
	public String toString() {
		/*return name + " : " + " [" + desWallBox + "]" + " [" + nonDesWallBox
				+ "]" + " [" + player + "]" + " [" + enemies + "]" + " ["
				+ powerUp + "]" + " [" + bomba + "]";*/
		return name;
	}

	public void removeEnemy(Enemy enemy) {
		enemies.remove(enemy.getPos());
		
	}


}
